package com.qf.controller;

import org.springframework.stereotype.Controller;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.servlet.http.HttpSession;

@Controller
@RequestMapping("/captcha")
public class CaptchaController {
    @RequestMapping("/test1")
    public void test(String captcha, HttpSession session){
        String validateCode = (String) session.getAttribute("captcha");
        if (!StringUtils.isEmpty(validateCode) && validateCode.equalsIgnoreCase(captcha)){
            session.removeAttribute("captcha");
            System.out.println("验证成功");
        }else{
            System.out.println("验证失败");
        }
    }
}
